import Section
class BlogPage():
    def __init__(self,step):
        self.step = int(step)
        self.__sections = {"body":Section.BlogData(self.step)}
        self.context = {}
        self.value = self.__sections['body']
        
    def blogrender(self):
        '''creates the context that is used for the most part of views function referring to the blog application'''
        self.context = {'pages':Section.BaseData().getPages(),
                        'articlelist':self.__sections['body'].getArticle(),
                        'css':self.__sections['body'].getCSS(),
                        'pagetitle':self.__sections['body'].getTitle(),
                        }
    def updateContext(self,udict):
        self.context.update(udict)
    def sidebar(self):
        self.__sections['sidebar'] = Section.SidebarData()
        articles = self.__sections['sidebar'].getArticle()
        dates = self.__sections['sidebar'].getSidebarDates(self.value)
        self.updateContext({"sidebar_data":articles})

